
<%@ page import="org.xilin.Semester" %>

<g:setProvider library="jquery"/>

<div class="bar">
  <span class="left">Semester</span>
  <g:if test="${session.roles?.contains('ROLE_ADMIN')}">
    <span class="btn right">
      <a class="create" href="javascript:void(0)" title="Add Semester" rel="${request.contextPath}/semester/create">Add Semester</a>
    </span>
  </g:if>
</div>

<x:pager/>
<table id="semesterTable" class="tablesorter">
  <thead>
      <tr>
          <th/>
          <th>${message(code: 'semester.year.label', default: 'Year')}</th>
          <th>${message(code: 'semester.semester.label', default: 'Semester')}</th>
          <th>${message(code: 'semester.startDate.label', default: 'Start Date')}</th>
          <th>${message(code: 'semester.endDate.label', default: 'End Date')}</th>
          <th>${message(code: 'semester.regStartDate.label', default: 'Reg Start Date')}</th>
          <th>${message(code: 'semester.regEndDate.label', default: 'Reg End Date')}</th>
          <th>${message(code: 'semester.regFee.label', default: 'Reg Fee')}</th>
          <th>${message(code: 'semester.podFee.label', default: 'POD Fee')}</th>
          <th>${message(code: 'semester.earlyRegDiscount.label', default: 'Early Reg Discount')}</th>
          <th>${message(code: 'semester.active.label', default: 'Active')}</th>
          <g:if test="${session.roles?.contains('ROLE_ADMIN')}">
            <th class="delete">Del</th>
            <th class="edit">Edit</th>
          </g:if>
      </tr>
  </thead>
  <tbody>
  <g:each in="${semesterInstanceList}" status="i" var="semesterInstance">
      <tr>
          <td>${i+1}</td>
          <td><g:formatNumber number="${semesterInstance.year}" format="####" /></td>
          <td>${fieldValue(bean: semesterInstance, field: "semester")}</td>
          <td><g:formatDate format="MM/dd/yyyy" date="${semesterInstance.startDate}" /></td>
          <td><g:formatDate format="MM/dd/yyyy" date="${semesterInstance.endDate}" /></td>
          <td><g:formatDate format="MM/dd/yyyy" date="${semesterInstance.regStartDate}" /></td>
          <td><g:formatDate format="MM/dd/yyyy" date="${semesterInstance.regEndDate}" /></td>
          <td>${fieldValue(bean: semesterInstance, field: "regFee")}</td>
          <td>${fieldValue(bean: semesterInstance, field: "podFee")}</td>
          <td>${fieldValue(bean: semesterInstance, field: "earlyRegDiscount")}</td>
          <td>${fieldValue(bean: semesterInstance, field: "active")}</td>
          <g:if test="${session.roles?.contains('ROLE_ADMIN')}">
            <td class="delete"><g:remoteLink action="delete" update="content" before="if(!confirm('Are you sure?')) return false;" id="${semesterInstance.id}"><span class="ui-icon ui-icon-trash"/></g:remoteLink></td>
            <td class="edit"><a href="#" title="Edit Semester" rel="${request.contextPath}/semester/edit/${semesterInstance.id}"><span class="ui-icon ui-icon-pencil"/></a></td>
          </g:if>
      </tr>
  </g:each>
  </tbody>
</table>

<script type="text/javascript">
  $(function(){
      setupAdminList({cluetipWidth:'800px'});
  });
</script>